<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />

		<link href="../../../css/mui.css" rel="stylesheet" />
		<link href="../../../css/common.css" rel="stylesheet" />

		<style>
		.mui-table-view{
			margin-top: 0px !important;
		}
		html,
		body {
			width: 100%;
			height: 100%;
			margin: 0px;
			padding: 0px;
			overflow: hidden;
			background-color: #efeff4;
		}
		#holder {
			width: 300px;
			height: 300px;
			border: solid 1px #bbb;
			border-radius: 5px;
			margin: 50px auto;
			background-color: #fff;
		}
		#alert {
			text-align: center;
			padding: 20px 10px;
		}
		</style>
	</head>

	<body>

		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left touch-action"></a>
			<h1 class="mui-title">手势图案设置</h1>
		</header>

		<div class="mui-content">
		<div id='holder' class="mui-locker" data-locker-options='{"ringColor":"rgba(210,210,210,1)","fillColor":"#ffffff","pointColor":"rgba(0,136,204,1)","lineColor":"rgba(0,136,204,1)"}' data-locker-width='300' data-locker-height='300'></div>
		<div id='alert'></div>
		</div>

		<script src="../../../js/mui.js"></script>
		<script src="../../../js/mui.locker.js"></script>
		
		<script type="text/javascript">
			mui.init()
			(function($, doc) {
				$.init();
				var holder = doc.querySelector('#holder'),
					alert = doc.querySelector('#alert'),
					record = [];
				//处理事件
				holder.addEventListener('done', function(event) {
					var rs = event.detail;
					if (rs.points.length < 4) {
						alert.innerText = '设定的手势太简单了';
						record = [];
						rs.sender.clear();
						return;
					}
					console.log(rs.points.join(''));
					record.push(rs.points.join(''));
					if (record.length >= 2) {
						if (record[0] == record[1]) {
							alert.innerText = '手势设定完成';
						} else {
							alert.innerText = '两次手势设定不一致';
						}
						rs.sender.clear();
						record = [];
					} else {
						alert.innerText = '请确认手势设定';
						rs.sender.clear();
					}
				});
			}(mui, document));
			mui.plusReady(function(){
				

		
				
				});
			
		</script>
	</body>

</html>
